package cn.iocoder.yudao.module.mini.dal.mysql.technician;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mini.dal.dataobject.technician.TechnicianDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mini.controller.admin.technician.vo.*;

/**
 * 技师 Mapper
 *
 * @author dzy
 */
@Mapper
public interface TechnicianMapper extends BaseMapperX<TechnicianDO> {

    default PageResult<TechnicianDO> selectPage(TechnicianPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TechnicianDO>()
                .eqIfPresent(TechnicianDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(TechnicianDO::getIntroduce, reqVO.getIntroduce())
                .eqIfPresent(TechnicianDO::getLifePhotos, reqVO.getLifePhotos())
                .eqIfPresent(TechnicianDO::getScore, reqVO.getScore())
                .eqIfPresent(TechnicianDO::getStatus, reqVO.getStatus())
                .inIfPresent(TechnicianDO::getMemberId,reqVO.getMemberIds())
                .betweenIfPresent(TechnicianDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TechnicianDO::getId));
    }

    default List<TechnicianDO> selectList(TechnicianExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<TechnicianDO>()
                .eqIfPresent(TechnicianDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(TechnicianDO::getIntroduce, reqVO.getIntroduce())
                .eqIfPresent(TechnicianDO::getLifePhotos, reqVO.getLifePhotos())
                .eqIfPresent(TechnicianDO::getScore, reqVO.getScore())
                .eqIfPresent(TechnicianDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(TechnicianDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TechnicianDO::getId));
    }

}
